﻿using System;
using System.Globalization;
using System.Windows.Data;
using System.Windows.Media.Imaging;
using LFSRecord2.Structures;

namespace LFSRecord2.View.Converters
{
    public class KWActiveImageConverter : IValueConverter
    {
        public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
        {
            string imageType = (string)parameter;

            if ((bool)value)
            {
                if (imageType == "LeftArrow")
                    return BitmapCache.KWLeftArrowOn;
                else if (imageType == "CenterDot")
                    return BitmapCache.KWCenterDotOn;
                else if (imageType == "RightArrow")
                    return BitmapCache.KWRightArrowOn;
            }
            else
            {
                if (imageType == "LeftArrow")
                    return BitmapCache.KWLeftArrowOff;
                if (imageType == "CenterDot")
                    return BitmapCache.KWCenterDotOff;
                if (imageType == "RightArrow")
                    return BitmapCache.KWRightArrowOff;
            }
            return new BitmapImage();
        }

        public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
        {
            return null;
        }
    }
}
